
#ifndef __STIMELIST_H__
#define __STIMELIST_H__

#include "alldefine.h"

#define	TIME_LIST_MAX		5	//定时任务数量

typedef struct
{
	
	uint8_t	Id;					//定时任务ID
	uint8_t	Enable;			//定时任务使能
	uint8_t onHours;		//启动时间-时
	uint8_t onMinutes;	//启动时间-分
	uint8_t offHours;		//结束时间-时
	uint8_t offMinutes;	//结束时间-分
	uint8_t	Week;				//星期选择：0=单次定时；0b00000000:每一位代表对应星期；最高位一直为0；
	uint8_t	RegAddress;	//动作执行寄存器序号
	
}sTimeListDef;

typedef struct
{
	uint8_t				TimeListSize;							//定时任务使用数量
	uint8_t				TimeListSizeMax;					//定时任务最大数量
	sTimeListDef	TimeList[TIME_LIST_MAX];	//定时任务
	
}sTimeListWorkDef;

typedef struct
{
	uint8_t	TimeListisWork[TIME_LIST_MAX];
	
	uint32_t tTime;				//当前的时间戳
	uint32_t NowMinutes;	//今日经过的时间(分)
	
	uint32_t OnUnixTime[TIME_LIST_MAX];		//定时任务启动时间(秒)
	uint32_t OffUnixTime[TIME_LIST_MAX];	//定时任务关闭时间(秒)
	
	struct
	{
		uint8_t Hours;
		uint8_t Minutes;
		uint8_t Seconds;
		uint8_t WeekDay;
		uint8_t Month;
		uint8_t Date;
		uint16_t Year; 
	}tDate;						//当前时间转换后

}TimeListDef;

extern sTimeListWorkDef *SysTimeList;

extern void sTimeListInit(void);
extern void SysTimeProcess(void);

#endif

